package com.ruitu.health_2.ui.adapter;

import android.content.Context;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.makeramen.roundedimageview.RoundedImageView;
import com.ruitu.arad.base.base_list.ListBaseAdapter;
import com.ruitu.arad.base.base_list.SuperViewHolder;
import com.ruitu.arad.util.SizeUtils;
import com.ruitu.health_2.R;
import com.ruitu.router_module.bean.product.ProHome;
import com.ruitu.router_module.util.GlideUtil;

public class SerachProListAdapter extends ListBaseAdapter<ProHome> {

    public SerachProListAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_search_pro_list;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        RoundedImageView icon = holder.getView(R.id.icon);
        TextView tv_name = holder.getView(R.id.tv_name);
        TextView tv_info = holder.getView(R.id.tv_info);
        TextView tv_price = holder.getView(R.id.tv_price);

        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) icon.getLayoutParams();
        params.width = SizeUtils.dp2px(110);
        params.height = params.width;
        icon.setLayoutParams(params);

        ProHome pro = mDataList.get(position);
        tv_name.setText(pro.getName());
        tv_info.setText(pro.getDescription());
        tv_price.setText("￥" + pro.getPrice());

        GlideUtil.loadImg(pro.getPic(), icon);
    }
}
